<?php

namespace App\Http\Presenters;

use Laracasts\Presenter\Presenter;

class UserPresenter extends Presenter
{
    /**
     * Present a link to the user gravatar
     */

    public function face()
    {
        switch ($this->gender) {
            case '1':
                return '<i class="iconfont smaller-80" style="color:#135FBA;padding-right:1px;">&#xe646;</i>';
                break;
            case '2':
                return '<i class="iconfont smaller-80" style="color:#D83671;padding-right:1px;">&#xe647;</i>';
                break;
            default:
                break;
        }
    }


    public function props()
    {
        $result = '';
        if ($this->stay == 1)
            $result .= '<span class="purple">留守</span> ';
        if ($this->poor == 1)
            $result .= ' <span class="pink">困难</span>';
        return $result;
    }


    public function sign()
    {
        if ($this->signed) {
            return '<a class="btn btn-xs btn-link3 smaller-50"><i class="ace-icon fa fa-check"></i></span></a>';
        } else {
            if( !$this->enabled ){
                return '<a class="btn btn-xs btn-blue3 sign" name="sign" data-uid="'. $this->id . '" data-type="' . $this->type . '"  disabled>签</a> ';
            }
            return '<a class="btn btn-xs btn-blue3 sign" name="sign" data-uid="'. $this->id . '" data-type="' . $this->type . '"  >签</a> ';
        }
    }


    public function award()
    {
        if ($this->type == 1) {
            if ($this->awarded) {
                return '<a class="btn btn-xs btn-link3 smaller-50"><i class="ace-icon fa fa-check"></i></span></a>';
            } else {
                if( !$this->enabled ){
                    return '<a class="btn btn-xs btn-green3 award" name="award" data-uid="' . $this->id . '" data-type="' . $this->type . '" disabled>奖</a> ';
                }
                return '<a class="btn btn-xs btn-green3 award" name="award" data-uid="' . $this->id . '" data-type="' . $this->type . '" >奖</a> ';
            }
        } 
    }

}
